package com.mirai.mirai_boot.controller;

import catcode.CatCodeUtil;
import catcode.CodeBuilder;
import catcode.Neko;
import love.forte.simbot.annotation.OnPrivate;
import love.forte.simbot.api.message.events.PrivateMsg;
import love.forte.simbot.api.sender.Sender;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * @author : CP
 * @version: 1.0
 * @program : mirai_boot
 * @description :
 * @date : 2021-07-01 12:05
 **/
@Service
public class MyPrivate {

    @OnPrivate
    public void getPrivate(PrivateMsg msg, Sender sender){
        System.out.println(msg);
        // 获取猫猫码工具
        CatCodeUtil util = CatCodeUtil.INSTANCE;
        CodeBuilder<String> stringBuilder  = util.getStringCodeBuilder("music",true);
//        String catCode = stringBuilder
//                .key("kind").value("NeteaseCloudMusic")
//                .key("title").value("那年· 年少")
//                .key("summary").value("宋宇宁")
//                .key("jumpUrl").value("https: //y.music.163.com/m/song/1495131163/?userid=1599018181, pictureUrl=http://p2.music.126.net/VuoQgDoLXx4CJsSXHL0rTA==/109951165466450525.jpg")
//                .key("musicUrl").value("http://music.163.com/song/media/outer/url?id=1495131163&userid=1599018181")
//                .key("brief").value("[分享]那年·年少")
//                .build();

//        String catCode = stringBuilder
//                .key("type").value("163")
//                .key("content").value("七音盒 - 云深不知处")
////                .key("summary").value("云深不知处")
//                .key("jumpUrl").value("https://www.kugou.com/song/#hash=707df6e3024ccb95ddf66c9612c351c9&album_id=40714865")
//                .key("pictureUrl").value("http://imge.kugou.com/stdmusic/20210312/20210312192355180621.jpg")
//                .key("musicUrl").value("https://webfs.ali.kugou.com/202107031052/c151465a8d80b280a38839cbb42c76bd/KGTX/CLTX001/707df6e3024ccb95ddf66c9612c351c9.mp3")
//                .key("brief").value("[分享]七音盒 - 云深不知处")
//                .build();
//        System.out.println(catCode);

        Map<String, String> map = new HashMap<>();
        map.put("content", "七音盒 - 云深不知处");
        map.put("type", "xiami");
        map.put("musicUrl", "https://webfs.ali.kugou.com/202107031052/c151465a8d80b280a38839cbb42c76bd/KGTX/CLTX001/707df6e3024ccb95ddf66c9612c351c9.mp3");
        map.put("title", "云深不知处");
        map.put("pictureUrl", "http://imge.kugou.com/stdmusic/20210312/20210312192355180621.jpg");
        map.put("jumpUrl", "https://www.kugou.com/song/#hash=707df6e3024ccb95ddf66c9612c351c9&album_id=40714865");
        map.put("brief", "[分享]七音盒 - 云深不知处");
        Neko music = util.toNeko("music", map);


        sender.sendPrivateMsg(msg,music.toString());


//        CodeBuilder<Neko> nekoBuilder = util.getNekoBuilder("music",true);
//        Neko catCode = nekoBuilder
//                .key("kind").value("NeteaseCloudMusic")
//                .key("title").value("那年· 年少")
//                .key("summary").value("宋宇宁")
//                .key("jumpUrl").value("https: //y.music.163.com/m/song/1495131163/?userid=1599018181, pictureUrl=http://p2.music.126.net/VuoQgDoLXx4CJsSXHL0rTA==/109951165466450525.jpg")
//                .key("musicUrl").value("http://music.163.com/song/media/outer/url?id=1495131163&userid=1599018181")
//                .key("brief").value("[分享]那年·年少")
//                .build();

//        System.out.println(catCode);
    }
}
